package database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import javax.swing.JOptionPane;

public class Conexion {
	
	public static Connection getConexion(boolean EsRemota){
        try{
            Class.forName("com.mysql.jdbc.Driver");
            Connection conexion;
            
            if(EsRemota)
                conexion = DriverManager.getConnection("jdbc:mysql://db4free.net:3306/sitram2534", "sitramuser", "**sitram2534**");
            else
                conexion = DriverManager.getConnection("jdbc:mysql://localhost/sitram2534", "sitramuser", "**sitram2534**");
            return conexion;
            
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, ex, "Error en la Base de datos", JOptionPane.ERROR_MESSAGE);
        } catch (ClassNotFoundException ex) {
            JOptionPane.showMessageDialog(null, ex, "Error en la Base de datos", JOptionPane.ERROR_MESSAGE);
        }
        return null;
    }


}
